package tools

import (
	"crypto/md5"
	"crypto/sha256"
	"encoding/hex"
)

func Sha256(text string) (encrypt string) {
	sha256Obj := sha256.New()
	sha256Obj.Write([]byte(text))
	sha256Encode := sha256Obj.Sum(nil)
	return hex.EncodeToString(sha256Encode)
}

func MD5(text string) (encrypt string) {
	md5Obj := md5.New()
	md5Obj.Write([]byte(text))
	md5Encode := md5Obj.Sum(nil)
	return hex.EncodeToString(md5Encode)
}
